package com.zktr.dao;

import java.util.LinkedHashMap;
import java.util.Map;

import com.zktr.pojo.Admin;
import com.zktr.pojo.AdminRole;
import com.zktr.utils.CRUDDAO;

public class AdminRoleDao {
	CRUDDAO<Admin> crud = new CRUDDAO<>(Admin.class);
	public static void main(String[] args) {
		AdminRoleDao adminRoleDao = new AdminRoleDao();
		AdminRole adminRole = new AdminRole();
		adminRole.setAdminrole(2);
		adminRole.setUserid(2);
		adminRole.setRoleid(2);
		int insertOneAdmin = adminRoleDao.insertOneAdmin(adminRole);
		System.out.println(insertOneAdmin);
	}
	/**
	 * 新增管理员信息
	 * @param goods
	 * @return
	 */
	public int insertOneAdmin(AdminRole ar) {
		Map<String,Object []> map=new LinkedHashMap<String,Object []> ();
		map.put("insert into admin_role values(?,?,?)", 
				new Object[]{ar.getAdminrole(),ar.getUserid(),ar.getRoleid()});
		 return crud.updateAll(map)[0];
	}
}
